home *** CD-ROM | disk | FTP | other *** search
- Path: access1.digex.net!not-for-mail
- From: ell@access1.digex.net (Ell)
- Newsgroups: comp.lang.c++
- Subject: Re: Bizzare C++ bug...PLEASE CHECK IT OUT
- Date: 17 Feb 1996 23:42:10 GMT
- Organization: The Universe
- Message-ID: <4g5p4i$lhk@news4.digex.net>
- References: <4fsns9$8ga3@flute.aix.calpoly.edu> <4g56r1$ep5@druid.borland.com>
- NNTP-Posting-Host: access1.digex.net
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- Pete Becker (pete@borland.com) wrote:
- : In article <4fsns9$8ga3@flute.aix.calpoly.edu>, mporcell@flute.aix.calpoly.edu
- : says...
- : >
- : >Clearly the call to the overloaded operator<< (r2) at r4 will cause a crash
- : >because it is a call from a base class constructor (B) to a virtual print
- : >function (r1) that does not get defined until the derived class C (r5).
- :
- : Nope. Calling a virtual function in a constructor results in a call to the
- : version of the function defined for that class. It does not call a "function
- : that does not get defined until the derived class". It is perfectly legal,
- : perfectly safe, and almost certainly incorrect.
-
- Yes, the real problem would be calling a pure virtual of a class in its
- ctor. This has undefined results, from what I know.
-
- Elliott
-